fix(config): add Mayflash GameCube Controller Adapter Support - #694
fix(config): add Mayflash GameCube Controller Adapter Support#694spenoff wants to merge 1 commit into
Conversation
…port This adapter's HID report descriptor declares its top-level collection as Usage(Joystick) [0x04] rather than Usage(Gamepad) [0x05], with its 16 face/shoulder buttons reported as a plain bitmask under the generic Button usage page. Because of this, the Linux kernel assigns the legacy joystick-era evdev codes BTN_TRIGGER (0x120) through BTN_DEAD (0x12f) to these buttons instead of the modern gamepad codes (BTN_SOUTH/0x130 etc.) that InputPlumber's generic evdev translation recognizes, so none of this adapter's face/shoulder buttons produced any input at all. Adds: - A capability map + device profile for this adapter, with the bit-to- button layout empirically confirmed on real hardware (adapter in PC/ DInput mode) by pressing each button in complete isolation and watching the translated output - not inferred from the original GameCube console protocol, which does not match this adapter's actual bit order. - Three new EventCode variants (evdev codes 0x12c-0x12e) which have no symbolic name in the Linux kernel headers but are legitimately reported by this class of hardware. - A test validating both new config files parse correctly and that capability_map_id is set on the source_devices entry itself, not just at the CompositeDeviceConfig level - only the former actually wires up per-event translation at runtime. Co-developed-by: Claude Sonnet 5 AI disclosure: this fix was developed interactively with Claude Code (Sonnet 5) over an extended debugging session. The root-cause diagnosis (HID Joystick vs Gamepad usage causing legacy evdev codes) was Claude's own investigation of the InputPlumber source. The bit-to-button mapping in the capability map was NOT AI-inferred - it was determined empirically by the human author pressing each physical button on real hardware in isolation while Claude captured and reported the resulting translated evdev output; several early AI-generated assumptions about the bit layout (based on the original GameCube console protocol) turned out to be wrong and were corrected only after the human author pushed back and asked for further isolated testing. The three new EventCode enum variants and the accompanying test were written by Claude and reviewed by the human author.
pastaq
left a comment
There was a problem hiding this comment.
Please remove all the AI slop comments. They don't add anything useful and nobody is going to read them.
Your specific config didn't need a test, the generic one works fine.
Complete the Capability for the new events so they have a capability they can translate from/to.
| # Unique identifier of the capability mapping | ||
| id: mayflash_gamecube_adapter | ||
|
|
||
| # Root cause: this adapter's HID report descriptor declares its top-level |
There was a problem hiding this comment.
This comment is over 60 lines long. Nobody is going to read that. Based on the first sentence it is probably not even necessary. Delete it.
| # xb360 model, unlike RightPaddle1/2 which are xbox-elite-only and were | ||
| # confirmed to silently produce no output when targeted here). | ||
| mapping: | ||
| # Physical GameCube A (confirmed via isolated press) is raw bit 1. |
There was a problem hiding this comment.
All of these button comments describe what we can already read in the config. Delete them.
| # Name of the composite device mapping | ||
| name: Mayflash GameCube Controller Adapter | ||
|
|
||
| # This adapter's HID report descriptor declares its top-level collection as |
There was a problem hiding this comment.
More AI slop comments. Delete them.
| Ok(()) | ||
| } | ||
|
|
||
| /// Quick validation test for the new Mayflash GameCube Controller Adapter |
There was a problem hiding this comment.
This doesn't need its own test
| BtnBase4, | ||
| BtnBase5, | ||
| BtnBase6, | ||
| /// evdev code 0x12c. No symbolic name exists in the Linux kernel headers |
| /// code that some hardware (e.g. HID joysticks whose report descriptor | ||
| /// declares a generic 16+ button Button usage page under a Joystick | ||
| /// rather than Gamepad top-level collection) legitimately reports. | ||
| BtnExtraOne, |
There was a problem hiding this comment.
This has no translation to a NativeEvent. It needs a full path to becoming a Capability or it isn't valid as an event.
It also starts a new convention instead of continuing an existing one, why note ButtonBase7-9?
| BtnBase5, | ||
| BtnBase6, | ||
| /// evdev code 0x12c. No symbolic name exists in the Linux kernel headers | ||
| /// (linux/input-event-codes.h jumps from BTN_BASE6/0x12b straight to |
There was a problem hiding this comment.
This should be fixed in the kernel.
This adapter's HID report descriptor declares its top-level collection as Usage(Joystick) [0x04] rather than Usage(Gamepad) [0x05], with its 16 face/shoulder buttons reported as a plain bitmask under the generic Button usage page. Because of this, the Linux kernel assigns the legacy joystick-era evdev codes BTN_TRIGGER (0x120) through BTN_DEAD (0x12f) to these buttons instead of the modern gamepad codes (BTN_SOUTH/0x130 etc.) that InputPlumber's generic evdev translation recognizes, so none of this adapter's face/shoulder buttons produced any input at all.
Adds:
Co-developed-by: Claude Sonnet 5
AI disclosure: this fix was developed interactively with Claude Code (Sonnet 5) over an extended debugging session. The root-cause diagnosis (HID Joystick vs Gamepad usage causing legacy evdev codes) was Claude's own investigation of the InputPlumber source. The bit-to-button mapping in the capability map was NOT AI-inferred - it was determined empirically by the human author pressing each physical button on real hardware in isolation while Claude captured and reported the resulting translated evdev output; several early AI-generated assumptions about the bit layout (based on the original GameCube console protocol) turned out to be wrong and were corrected only after the human author pushed back and asked for further isolated testing. The three new EventCode enum variants and the accompanying test were written by Claude and reviewed by the human author.